Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poc(spacing): Simplify managing whitespace between page sections #1899

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

VincentSmedinga
Copy link
Contributor

@VincentSmedinga VincentSmedinga commented Mar 1, 2025

Describe the pull request

Thank you for contributing to the project!
Please use this template to help us handle your PR smoothly.

What

This is a proof of concept to show how Screen, Spotlight, Breakout and a new Page Body component could manage space largely automatically. It allows removing the padding props from Grid.

Check the example pages, ignore the component examples in this PR.

It moves the responsibility for whitespace between components to the parent, where it belongs and prevents having to scatter around margin classes, which is error-prone and subject to the tastes of the implementer. It works well for general cases, but needs a bit more thought for some situations:

  1. The breadcrumb sits tightly above the page title, but the page title should be in a main elament while the breadcrumb shouldn’t. That prevents an approach like <PageBody as="main"><Grid><Grid.Cell><Breadcrumb /><Heading />…. We might need a prop for Grid Cell to negate the gap at its bottom.
  2. The parent-child relationship that gap needs will sometimes be in the way, e.g. when components that should be separated by grid space must also have a shared parent element, making them grandchildren.
  3. …?

Idea: change the concept of a ‘page body’ to a ‘grid gap’ utility. Oh wait, we already have it: it’s called Column.

Why

To simplify assigning white space between large page sections.

How

  • With good old overrides and !important style rules, see screen-poc-space.scss.
  • With a debug stylesheet to indicate where the sections and the white space are: screen-poc-space.scss.
  • Comment out the @use of the latter to see the pages as intended.

Checklist

Before submitting your pull request, please ensure you have done the following. Check each checkmark if you have done so or if it wasn't necessary:

  • Add or update unit tests
  • Add or update documentation
  • Add or update stories
  • Add or update exports in index.* files
  • Start the PR title with a Conventional Commit prefix, as explained here.

Additional notes

  • This will still hold if we merge Component Space and Grid Space – grid gap will then use e.g. the XL space token.

@VincentSmedinga VincentSmedinga requested a review from dlnr March 1, 2025 16:29
@VincentSmedinga VincentSmedinga requested a review from a team as a code owner March 1, 2025 16:29
@VincentSmedinga VincentSmedinga marked this pull request as draft March 1, 2025 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant